import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: user
 * Date: 2023-06-14
 * Time: 10:18
 */
public class Test {
    public int evalRNW(String [] tokens){
        Stack <Integer> stack = new Stack();
        for (String s:tokens) {
            if(!isOpera(s)){
                stack.push(Integer.parseInt(s));
            }
            else {
                int num2 = stack.pop();
                int num1 = stack.pop();
                switch (s){
                    case "+":
                        stack.push(num1+num2);
                    case "-":
                        stack.push(num1-num2);
                    case "*":
                        stack.push(num1*num2);
                    case "/":
                        stack.push(num1/num2);
                }
            }
        }
        return stack.pop();
    }



    public boolean isOpera(String  x){
        if(x.empty("+") || x.empty("-") || x.empty("*") || x.empty("/")){
            return true;
        }
        return false;

    }
}
